<%--
  Created by IntelliJ IDEA.
  User: cyrus
  Date: 2021/07/29
  Time: 9:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>注册界面</title>
    <style>
        .container {
            width: 300px;
            margin: 150px auto;
        }

        .container > form > div {
            padding: 10px 10px;
        }

        .container > form > div > div {
            float: left;
            width: 60px;
        }

    </style>
</head>
<body>
<c:if test="${sessionScope.isLogin}">
    <div>当前登陆人: ${sessionScope.loginUser.nickname}</div>
</c:if>
<c:if test="${!sessionScope.isLogin}">
    <a href="${pageContext.request.contextPath}/login.jsp">登录</a>
</c:if>
<div class="container">
    <h1>学生管理系统</h1>
    <form action="${pageContext.request.contextPath}/student/edit" method="post">
        <div>
            <div><label for="username">用户名</label></div>
            <input type="text" id="username" name="username" hidden value="${student.username}">
            ${student.username}
        </div>
        <div>
            <div><label for="password">密码</label></div>
            <input type="text" id="password" name="password" value="${student.password}">
        </div>
        <div>
            <div><label for="nickname">昵称</label></div>
            <input type="text" id="nickname" name="nickname" value="${student.nickname}">
        </div>
        <div>
            <div><label for="age">年龄</label></div>
            <input type="number" id="age" name="age" value="${student.age}">
        </div>
        <div>
            <div><label for="birthday">生日</label></div>
            <input type="date" id="birthday" name="birthday" value="<fmt:formatDate value="${student.birthday}" pattern="yyyy-MM-dd" />">
        </div>
        <button>提交</button>
    </form>
    <c:if test="${not empty error}">
        <div style="color: red">${error}</div>
    </c:if>
</div>
</body>
</html>
